import router from "@src/router";
import base from "@src/store/base";
import { storeBindingsBehavior } from "mobx-miniprogram-bindings";
import config from "@src/config";

Page({
  behaviors: [router.routerBehavior, storeBindingsBehavior],
  storeBindings: [
    {
      store: base,
      fields: ["themeColor", "themeTitleColor"],
    },
  ],
  properties: {
    productNo: {
      type: String,
      value: "",
    },
  },
  data: {
    productDetailData: null,
    webSrc: {
      dev: "https://demoh5.xiangsaopay.com/#/",
      test: "https://diyh5-pre.xiangsaopay.com/#/",
      build: "https://diyh5.xiangsaopay.com/#/",
    },
    webH5Src: "",
  },
  onLoad(options) {
    this.setData({
      webH5Src: `${this.data.webSrc[config.NODE_ENV]}?pageId=${options?.pageId}`,
    });
    console.log(`----环境变量=${config.NODE_ENV}-----`,this.data.webH5Src);
  },
  onUnload() {},
  methods: {
    onLogin() {},
    onShareAppMessage(res) {
      // return {
      //   title: `分享好礼给你，只需 ${this.data.productDetailData.productPoint} 积分即可兑换，快来一起兑换吧`,
      //   path: `sp-member/pages/redemptionDetails/main?productNo=${this.data.productNo}`,
      //   desc: "",
      //   imageUrl: this.data.shareImg,
      // };
    },
  },
});
